package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.capital.UserAdaPayLogDao;
import com.tbit.uqbike.client.pojo.newEntity.UserAdaPayLog;
import com.tbit.uqbike.client.service.UserAdaPayLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * @Author: chen
 * @Description: 用户分账详细日志
 * @Date: 创建于 14:14 2022/2/22
 */
@Service
public class UserAdaPayLogServiceImpl implements UserAdaPayLogService {

    @Autowired
    private UserAdaPayLogDao userAdaPayLogDao;

    @Override
    public List<UserAdaPayLog> getByPaymentId(String paymentId) {
        return userAdaPayLogDao.getByPaymentId(paymentId);
    }

    @Override
    public List<UserAdaPayLog> getByConfirmId(String confirmId) {
        return userAdaPayLogDao.getByConfirmId(confirmId);
    }

    @Override
    public List<UserAdaPayLog> getBuBuyOrderNO(String orderNO) {
        return userAdaPayLogDao.getBuBuyOrderNO(orderNO);
    }

    @Override
    public void edit(UserAdaPayLog userAdaPayLog) {
        userAdaPayLogDao.edit(userAdaPayLog);
    }

    @Override
    public void addBatch(List<UserAdaPayLog> list) {
        userAdaPayLogDao.addBatch(list);
    }

    @Override
    public void editRefund(UserAdaPayLog userAdaPayLog) {
        if (Objects.isNull(userAdaPayLog.getRefundTime())){
            userAdaPayLog.setRefundTime(new Date());
        }
        userAdaPayLogDao.editRefund(userAdaPayLog);
    }

}
